package data.wg;

import java.util.Calendar;


import main.WoTCWBot;


public class WGScheduledBattle extends AbstractWoTCWBotListEntity implements Comparable<WGScheduledBattle> 
{
	public String nameOfProvince,idOfProvince,typeOfBattle,arena;
	public long at;
	public Calendar battleStartCalendar, battleOpenCalendar;
	public boolean started;
	
	public WGScheduledBattle()
	{
		started=false;
	}
	
	
	@Override
	public String toString()
	{
		return "Battle: "+nameOfProvince+"("+typeOfBattle+", "+arena+") at "+battleStartCalendar.get(Calendar.HOUR_OF_DAY)+":"+battleStartCalendar.get(Calendar.MINUTE)+" GMT+1";
	}
	
	

	public String getMessageString()
	{
		String text;
		if(started)
		{
			text = battleOpenCalendar.get(Calendar.HOUR_OF_DAY) + ":" + battleOpenCalendar.get(Calendar.MINUTE) + "  "+arena+ " ("+getOwner()+", "+nameOfProvince+")";
		}
		else
		{
			text = battleStartCalendar.get(Calendar.HOUR_OF_DAY) + ":" + battleStartCalendar.get(Calendar.MINUTE) + "+  "+arena+ " ("+getOwner()+", "+nameOfProvince+")";
		}
		return text;
	}
	
	public String getOwner()
	{
//		for(WGProvince p:WoTCWBot.provincesList)
//		{
//			if(p.name.equals(idOfProvince))
//			{
//				return p.clan;
//			}
//		}
		return "PlaceholderOwner";
	}


	@Override
	public int compareTo(WGScheduledBattle sb) {
		if(sb.at>at)
		{
			return -1;
		}
		return 1;
		
	}
}
